import 'package:test/test.dart';
void main() {

  test("类型声明可以省略",() {
    final String a = 'ducafecat';
    final a1 = 'ducafecat';
    const String a2 = 'ducafecat';
    const a3 = 'ducafecat';
  });


  test( "初始后不能再赋值",() {
    final a = 'ducafecat';
    // a = 'abc';
    const a1 = 'ducafecat';
    // a1 = 'abc';
  });

  test("不能和 var 同时使用",() {
    // final var a2= 'ducafecat';
    // const var a1 = 'ducafecat';
  });


  test ("const 赋值 申明可省略",() {
    const List ls = const [11, 22, 33];
    const List ls1 = [11, 22, 33];
  });


  test ("比较 1 - 需要确定的值",() {
    final dt = DateTime.now();
    print(dt);
    // const dt = const DateTime.now();
    print(dt);
  });

  // 数组指针不可变 但是数组元素可以变`
  test ("比较 2 - 不可变性可传递",() {
    final List ls = [11, 22, 33];
    ls[1] = 44;
    print(ls);
    const List ls1 = [11, 22, 33];
    ls[1] = 44;
    print(ls);
  });

  test( "比较 3 - 内存中重复创建",()
  {
    final a1 = [11, 22];
    final a2 = [11, 22];
    print(identical(a1, a2));

    const a11 = [11, 22];
    const a21 = [11, 22];
    print(identical(a11, a21));
  });

}
